package org.cug.uav.gcs.ui;

import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Combo;

public class SettingDlg extends Dialog {

	protected Object result;
	protected Shell shell;

	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public SettingDlg(Shell parent, int style) {
		super(parent, style);
		setText("SWT Dialog");
	}

	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell.open();
		shell.layout();
		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}

	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shell = new Shell(getParent(), SWT.DIALOG_TRIM);
		shell.setSize(312, 229);
		shell.setText("\u8BBE\u7F6E");
		shell.setLayout(new FillLayout(SWT.HORIZONTAL));
		
		TabFolder settingTab = new TabFolder(shell, SWT.BORDER);
		settingTab.setSelection(1);
		
		TabItem portTabItem = new TabItem(settingTab, SWT.NONE);
		portTabItem.setText("\u4E32\u53E3\u53C2\u6570");
		
		Composite portTab = new Composite(settingTab, SWT.NONE);
		portTabItem.setControl(portTab);
		
		Label label = new Label(portTab, SWT.NONE);
		label.setBounds(26, 37, 41, 12);
		label.setText("\u7AEF\u53E3\uFF1A");
		
		Combo portCombo = new Combo(portTab, SWT.NONE);
		portCombo.setBounds(73, 34, 87, 20);
		
		TabItem comunicationTabItem = new TabItem(settingTab, SWT.NONE);
		comunicationTabItem.setText("\u901A\u4FE1\u9891\u7387");
		
		TabItem motorTabItem = new TabItem(settingTab, SWT.NONE);
		motorTabItem.setText("\u7535\u673A\u6D4B\u8BD5");

	}

}
